package com.example.forjava.event;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EventController {

    @Autowired
    private EventPublisher eventPublisher;

    @RequestMapping("/publish")
    public String publishEvent(@RequestParam("message") String message) {
        eventPublisher.publishEvent(message);
        return "Event published!";
    }
}